home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 25
/
Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso
/
Aminet
/
dev
/
amos
/
AMOS0398.lzh
/
AMOSLIST
/
000181_amos-request@svcs1.digex.net_Fri Mar 20 03:44:32 1998.msg
< prev
next >
Wrap
Text File
|
1998-04-01
|
5KB
|
166 lines
>From amos-request@svcs1.digex.net Fri Mar 20 03:44:31 1998
Received: from svcs1.digex.net (svcs1.digex.net [204.91.197.224])
by pony-1.mail.digex.net (8.8.8/8.8.8) with ESMTP id DAA17373
for <mcox@access.digex.net>; Fri, 20 Mar 1998 03:44:31 GMT
Received: (from daemon@localhost)
by svcs1.digex.net (8.8.5/8.8.5) id SAA29568
for amos-out; Thu, 19 Mar 1998 18:18:39 -0500 (EST)
Received: from pony-2.mail.digex.net (pony-2.mail.digex.net [204.91.241.6])
by svcs1.digex.net (8.8.5/8.8.5) with ESMTP id SAA29565
for <amos-list@svcs1.digex.net>; Thu, 19 Mar 1998 18:18:39 -0500 (EST)
Received: from post.mail.demon.net (post-20.mail.demon.net [194.217.242.27])
by pony-2.mail.digex.net (8.8.8/8.8.8) with SMTP id SAA08133
for <amos-list@access.digex.net>; Thu, 19 Mar 1998 18:18:37 -0500 (EST)
Received: from agasinc.demon.co.uk ([193.237.4.98]) by post.mail.demon.net
id af2004235; 19 Mar 98 23:17 GMT
From: Andy Gibson <andy@agasinc.demon.co.uk>
To: Amos List <amos-list@access.digex.net>
Date: Thu, 19 Mar 1998 00:42:36 -0000
Message-ID: <yam7382.1809.2015119832@post.demon.co.uk>
In-Reply-To: <664.381T895T8483212@bahnhof.se>
X-Mailer: YAM 1.3.4 [020] - Amiga Mailer by Marcel Beck
Organization: AGAS Productions
Subject: Re: Ooops! Textfile parsing
MIME-Version: 1.0
Content-Type: text/plain
Status: O
X-Status:
On Wednesday 18-Mar-98 at 13:08:17, a nutter named Jonas Thorell
had wet pants when they typed about `Re: Textfile parsing'.
>Thanks for the example. It doesn't quite work but I'll see if I can work out
>what's going on. When I enter s:startup-sequence as input-file I just get the
>first line of it for some reason.
Ooops! I made a slight error in the code. Well, I was typing it up as
an example. Anyway, here is what it should be like. Hope this helps...
<SNIP>
'
' ***************************************
'
' Load and process a text file easily :)
' bY Andy Gibson
'
' I hope this helps you out Jonas....
' Sorry about the last one! This one's
' fine though :-)
'
' ***************************************
'
' Depending on the size of your file, you may need to UP this value...
Set Buffer 40
'
' LINES must be global here...
Global TXT$,LINES
'
' Enter your text file's full path here...
Proc _LOAD_TXT["hd2:text/Letter.asc"]
'
'
' Now we can use a Dim with the correct amount of lines to hold
' each line in there...
Dim TXT$(LINES)
Global TXT$()
'
' Simply sort the lines into the Global Dim here...
Proc _SORT_FILE
'
'
' Now you can easily read any line of the text held in the array
' TXT$().
'
' eg. Print first 10 lines of text file...
For _DISPLAY=0 To 10
Print TXT$(_DISPLAY)
Next _DISPLAY
Edit
'
'
'
' Procedure are here...
'
Procedure _LOAD_TXT[TXT$]
'
' This Proc will work out how many lines are in your file.
' Checks for normal Chr$(10) RETURN code. You could alter
' it to Chr$(13) for PC text files if need be....
'
' Amcaf only.... (no need to use Open in etc...)
' Dload TXT$,17
'
'
' Amos normal way...
Open In 1,TXT$
L=Lof(1) : Close 1
Reserve As Data 7,L
Bload TXT$,7
'
'
' Read Lines...
POS=Start(7) : LINES=0
'
Do
Exit If POS>=Bank End(7)
LINE=Hunt(POS To Bank End(7),Chr$(10))
'
' Wanna see the text...
' A$=Peek$(POS,POS-LINE,Chr$(10))
' Print A$
'
Exit If LINE=Bank End(7) or LINE=0
POS=LINE+1
Inc LINES
Loop
'
' One other point to note, the Bank End command is not an normal
' Amos Pro one! And I can't remember which Ext I have installed
' which uses it! If this code doesn't funtion properly in your
' interpreter, simply change the Bank End commands to summat
' more suitable like Start(bnk)+start(bnk) to Length(bnk)
'
End Proc
Procedure _SORT_FILE
'
' Hold each line of text in the array...easy or what?
'
POS=Start(7)
'
For I=0 To LINES
A$=Peek$(POS,Bank End(7),Chr$(10))
If A$>""
TXT$(I)=Peek$(POS,Bank End(7),Chr$(10))
Add POS,Len(TXT$(I))+1
Else
Inc POS
End If
Next I
'
' No more need to hold the file in a mem bank, so erase it...
'
Erase 7
'
End Proc
'
<SNIP>
Once again, sorry for the slight mix-up with the last one sent!
If you need further help, feel free to email me. I'll do my best.
Tarra. Andy Gibson
--
*****************************************************************
*_______/\_____/\_______/\_____/\ *
*\ /\ ___/\ /\ ___/ Andy Gibson <---------------- *
* \_/\ / /\/| _ \_/\ / \/ \ ----------> aka SKiDZ/Area 51 *
* / _/ / / |_| // _/ / __\ \ *
* \// / \___ / \// / /__ / andy@agasinc.demon.co.uk *
* /_/ \_/ /_/ \_/ <-=-=-=-=-=-=-=-=-=-> *
* pRODUCTiONS 9T8 *
*****************************************************************